package com.wwdx.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wwdx.utils.excel.ExcelCell;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author liguoliang
 * @date 2017/11/17.
 */
@Entity
@Table(name = "wwdx_order")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WwdxOrderModel implements java.io.Serializable {
    
    @Id
    @GeneratedValue
    private Integer id;
    /**
     * 产品类型 1阅读包 2解读版 3阅读币 4小课 7会员
     */
    private Integer type;
    @ExcelCell(index = 2)
    private BigDecimal price;
    private Long product_id;
    /**
     * 支付状态 0未支付 1已支付
     */
    private Integer status;
    @Column(name="create_time", updatable = false)
    private Date createTime;
    @JsonIgnore
    @ExcelCell(index = 6)
    @Column(name = "pay_time")
    private Date payTime;
    /**
     * 支付类型 11 支付宝APP 121 微信APP 122 微信H5 123 微信小程序 131 虚拟币充值 132 虚拟币消费 14 赠一得一 15 兑换码
     */
    @Column(name = "pay_type")
    private Integer payType;
    private String orderno;
    private String unionid;
    @ExcelCell(index = 5)
    private String channel;
    /**
     * 商户ID
     */
    @Column(name = "merchant_id")
    private String merchantId;

    /**
     * 产品优惠卷价格
     */
    @Transient
    private BigDecimal productCouponPrice;

    @ExcelCell(index = 3)
    @Transient
    private String productName;
    @ExcelCell(index = 4)
    @Transient
    private String memberName;
    @Transient
    private String openId;
    @ExcelCell(index = 1)
    @Transient
    private String strType;
    @ExcelCell(index = 7)
    @Transient
    private String isPay;

    @Override
    public String toString() {
        return ToStringUtils.toSimpleString(this);
    }
}